<template>
  <div class="box">
     <mt-radio
     align="right"
     v-model="payType"
     :options="options">
    </mt-radio>
     <div class="buttonbox fixed" ref="buttonbox" @click="pay">
        确认支付
      </div>
  </div>
</template>
<script>
import { Radio,MessageBox } from 'mint-ui';
import {
  integralExchangeProduct,hkbOrderpay
} from "src/methods/request.js";
export default {
  data() {
    return {
      route:{},
      orderNo:"",
      productName:"",
      productType:"",
      isHkb:"",
      payType:"",
      options : ""
    };
  },
  computed:{
    imgUrl(){
      return this.$store._modules.root._children.a.state
    }
  },
   created() {
    // $router 直接监听无效，尚未查明，故作深拷贝处理
    this.route = Object.assign({}, this.$route);
    //此处应该发送请求
    this.orderNo = this.route.query.orderNo;
    this.isHkb = JSON.parse(localStorage.getItem('isHkb'));
    if(this.isHkb == '1'){
      this.options = [{  
            label: '微信支付',  
            value: '0'  
            },{  
            label: '汇卡宝支付',  
            value: '1'  
            }]
    }else{
      this.options = [{  
            label: '微信支付',  
            value: '0'  
            }]
    }
  },
  methods:{
    pay(){
      console.log(this.payType)
      if(this.payType == "0"){
        
      }else{
        MessageBox.confirm("",{
                            message: "确定支付？",
                            }).then(action => {
                                if (action == 'confirm') {
                                       hkbOrderpay({orderNo:this.orderNo}).then(
                                                  response => {
                                                        if(response.rspCode=="0000"){
                                                              if(response.data.resultCode=="00"){
                                                                //  this.$router.push({
                                                                //         path:"/MoneyEnd",
                                                                //         query:{
                                                                //         }
                                                                //   })
                                                                  MessageBox('', response.rspMsg||'支付成功');
                                                              }else if(response.data.resultCode=="04"){
                                                                  if(response.data.content==undefined){
                                                                     MessageBox('', '支付系统异常');
                                                                  }
                                                                  window.open(response.data.content,"_self")
                                                              }else if(response.data.resultCode=="01"){
                                                                     MessageBox('', '积分不走'); 
                                                              }else if(response.data.resultCode=="02"){
                                                                     MessageBox('', '系统繁忙'); 
                                                              }else{
                                                                  MessageBox('', response.data.resultMesg||'支付失败');
                                                              }
                                                        }else{
                                                          MessageBox('', response.rspMsg||'支付失败');
                                                        }
                                                  }
                                                ).catch(
                                                  error => console.log(error)
                                              );
                                }
                         })

      }
      //  this.$router.push({
      //     path:"/MoneyEnd"
      //   })
    },
  },
   watch: {
    route() {
      if (this.route.path == "/MoneyEnd") {

      }
    }
  }
}
</script>
<style lang="less" scoped>.box {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 40px;
    background-color:#f1f2f3;
     .ft{
      font-size: 19px;
      min-height: 30px;
      line-height: 22px;
    }
    .line{
      height: 3em;
      line-height: 3rem;
    }
    .color{
      color: #ED6E36;
    }
    .swiper-container {
       height:16rem;
      img{
        width: 91%;
        height: 90%;
        box-shadow: 0px 0px 10px gray;
        box-sizing: border-box;
        border-radius: 5px;
      }
    }
   .title {
      height: 5rem;
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin:0.5rem 0 0.5rem 0;
      img{
        height: 20px;
        margin-right: 0.7rem;
      }
      span{
        font-size: 20px;
        color: #ED6E36;
      }
    }
    .buttonbox {
        margin-top: 20px;
        margin-left: 4.5%;
        width: 91%;
        color: #fff;
        height: 40px;
        background-color: #ED6E36;
        line-height: 40px;
        border-radius: 5px;
        text-align: center;
    }
    .bgcolor {
        background-color: #E5E5E5;
    }
    .fixed {
        position: fixed;
        bottom: 30px;
        left: 0px;
    }
}

</style>


